package com.pimee.web;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.view.RedirectView;

import io.swagger.annotations.ApiOperation;

@Controller
public class RouteController {

	/****************** 系统模块 start ***************************************/
	@ApiOperation("系统登录")
	@GetMapping("/admin/login")
	public String loginPage() {
		return "admin/login";
	}

	@ApiOperation("进入用户列表")
	@GetMapping("/admin/sys/user")
	public String userIndex() {
		return "admin/sys/user";
	}

	@ApiOperation("进入用户列表")
	@GetMapping("/system/user")
	public String user() {
		return "admin/sys/user/user";
	}

	@ApiOperation("进入用户个人中心")
	@GetMapping("/system/user/profile")
	public RedirectView profile() {
		RedirectView redirectTarget = new RedirectView();
		redirectTarget.setContextRelative(true);
		redirectTarget.setUrl("/admin/sys/user/profile");
		return redirectTarget;
	}

	@ApiOperation("进入菜单列表")
	@GetMapping("/system/menu")
	public String menu() {
		return "admin/sys/menu/menu";
	}

	@ApiOperation("进入代理列表")
	@GetMapping("/system/dept")
	public String dept() {
		return "admin/sys/dept/dept";
	}

	@ApiOperation("进入角色列表")
	@GetMapping("/system/role")
	public String role() {
		return "admin/sys/role/role";
	}

	@ApiOperation("进入数据字典列表")
	@GetMapping("/system/dict")
	public String dict() {
		return "admin/sys/dict/type/type";
	}

	@ApiOperation("进入用户列表")
	@GetMapping("/system/config")
	public String config() {
		return "admin/sys/config/config";
	}

	@ApiOperation("进入岗位管理")
	@GetMapping("/system/post")
	public String post() {
		return "admin/sys/post/post";
	}

	@ApiOperation("进入通知管理")
	@GetMapping("/system/notice")
	public String notice() {
		return "admin/sys/notice/notice";
	}

	@ApiOperation("进入人员角色")
	@GetMapping("/system/userRole")
	public String userRole() {
		return "admin/sys/auth/userRole";
	}

	@ApiOperation("进入操作日志列表")
	@GetMapping("/system/event")
	public String event() {
		return "admin/sys/event/event";
	}

	@ApiOperation("进入任务列表")
	@RequiresPermissions("monitor:job:view")
	@GetMapping("/monitor/job")
	public String job() {
		return "admin/monitor/job/job";
	}
	
	@ApiOperation("进入在线用户列表")
	@RequiresPermissions("monitor:online:view")
	@GetMapping("/monitor/online")
	public String online() {
		return "admin/monitor/online/online";
	}

	@ApiOperation("进入OEM列表")
	@RequiresPermissions("system:unit:view")
	@GetMapping("/system/unit")
	public String unit() {
		return "admin/sys/unit/unit";
	}

	/****************** 系统模块 end ***************************************/

	/****************** 业务模块 start ***************************************/

	@ApiOperation("进入设备列表")
	@RequiresPermissions("bs:machine:view")
	@GetMapping("/bs/machine/{busiType}")
	public String machine(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		return "admin/bs/prod/machine";
	}

	@ApiOperation("进入设备锁道列表")
	@RequiresPermissions("bs:machineChannel:view")
	@GetMapping("/bs/machineChannel/{busiType}")
	public String machineChannel(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		return "admin/bs/prod/machineChannel";
	}

	@ApiOperation("进入雨伞列表")
	@RequiresPermissions("bs:umbrella:view")
	@GetMapping("/bs/umbrella")
	public String umbrella() {
		return "admin/bs/prod/umbrella";
	}

	@ApiOperation("进入产品列表")
	@RequiresPermissions("bs:prod:view")
	@GetMapping("/bs/prod/{busiType}")
	public String prod(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		return "admin/bs/prod/prod";
	}
    //type为9跳转到充电线
	@ApiOperation("进入产品批次属性列表")
	@RequiresPermissions("bs:prodProperty:view")
	@GetMapping("/bs/prodProperty/{busiType}")
	public String prodProperty(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		if(busiType.equals(9)) {
			return "admin/bs/prod/lineProperty";
		}
		return "admin/bs/prod/prodProperty";
	}

	@ApiOperation("进入关于我们列表")
	@RequiresPermissions("bs:about:view")
	@GetMapping("/bs/about")
	public String about() {
		return "admin/bs/about/about";
	}

	@ApiOperation("进入押金规则列表")
	@RequiresPermissions("bs:depositRule:view")
	@GetMapping("/bs/depositRule/{busiType}")
	public String depositRule(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		return "admin/bs/rule/depositRule";
	}

	@ApiOperation("进入租金规则列表")
	@RequiresPermissions("bs:rentRule:view")
	@GetMapping("/bs/rentRule/{busiType}")
	public String rentRule(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		if(busiType.equals(9)) {
			return "admin/bs/rule/lineRentRule";
		}
		return "admin/bs/rule/rentRule";
	}

	@ApiOperation("进入分润规则列表")
	@RequiresPermissions("bs:disProfitRule:view")
	@GetMapping("/bs/disProfitRule/{busiType}")
	public String disProfitRule(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		return "admin/bs/rule/disProfitRule";
	}
	
	@ApiOperation("进入机器利润排序列表")
	@RequiresPermissions("bs:order:view")
	@GetMapping("/bs/order/machineSort")
	public String machineOrderCount( ModelMap modelMap) {
		return "admin/bs/order/machineOrderCount";
	}

	@ApiOperation("进入订单列表")
	@RequiresPermissions("bs:order:view")
	@GetMapping("/bs/order/{busiType}/{fromSource}")
	public String bsOrder(@PathVariable("busiType") Integer busiType, @PathVariable("fromSource") Integer fromSource,
			ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		modelMap.put("fromSource", fromSource);
		return "admin/bs/order/order";
	}

	@ApiOperation("进入押金列表")
	@RequiresPermissions("bs:deposit:view")
	@GetMapping("/bs/deposit")
	public String deposit() {
		return "admin/bs/fund/deposit";
	}

	@ApiOperation("进入充值列表")
	@RequiresPermissions("bs:recharge:view")
	@GetMapping("/bs/recharge")
	public String recharge() {
		return "admin/bs/fund/recharge";
	}

	@ApiOperation("进入分润订单列表")
	@RequiresPermissions("bs:disProfitOrder:view")
	@GetMapping("/bs/disProfitOrder/{busiType}")
	public String disProfitOrder(@PathVariable("busiType") Integer busiType, ModelMap modelMap) {
		modelMap.put("busiType", busiType);
		return "admin/bs/stat/disProfitOrder";
	}
	@ApiOperation("进入提现账户列表")
	@RequiresPermissions("bs:accountVerify:view")
	@GetMapping("/bs/accountVerify/list")
	public String accountVerify(ModelMap modelMap) {
		return "admin/bs/account/accountVerify";
	}	
	@ApiOperation("进入提现记录列表")
	@RequiresPermissions("bs:payExtractPriceLog:view")
	@GetMapping("/bs/payExtractPriceLog")
	public String payExtractPriceLog(ModelMap modelMap) {
		return "admin/bs/account/payExtractPriceLog";
	}
	@ApiOperation("进入微信用户列表")
	@RequiresPermissions("bs:user:view")
	@GetMapping("/bs/user/{fromSource}")
	public String bsUser(@PathVariable("fromSource") Integer fromSource, ModelMap modelMap) {
		modelMap.put("fromSource", fromSource);
		return "admin/bs/user/bsUser";
	}

	/****************** 业务模块 end ***************************************/

	/****************** 微信模块 start ***************************************/
	@ApiOperation("进入微信小程序配置列表")
	@RequiresPermissions("wx:miniSetting:view")
	@GetMapping("/wx/miniSetting")
	public String wxMiniSetting() {
		return "admin/wx/miniSetting/miniSetting";
	}

	@ApiOperation("进入微信支付配置列表")
	@RequiresPermissions("wx:paySetting:view")
	@GetMapping("/wx/paySetting")
	public String wxpaySetting() {
		return "admin/wx/paySetting/paySetting";
	}

	/****************** 微信模块 end ***************************************/

	/****************** 支付宝模块 start ***************************************/
	@ApiOperation("进入支付宝小程序配置列表")
	@RequiresPermissions("ali:miniSetting:view")
	@GetMapping("/ali/miniSetting")
	public String miniSetting() {
		return "admin/ali/miniSetting/miniSetting";
	}
	/****************** 支付宝模块 end ***************************************/

}
